package com.goteam.lmapp.core.netty.initializer;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpRequestDecoder;
import io.netty.handler.codec.http.HttpResponseEncoder;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.handler.codec.string.StringEncoder;
import io.netty.util.CharsetUtil;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.goteam.lmapp.core.netty.handler.CoreServerHandler;

@Component
public class CoreServerInitializer extends ChannelInitializer<SocketChannel> {

	@Autowired
	private CoreServerHandler coreServerHandler;

	@Override
	protected void initChannel(SocketChannel ch) throws Exception {
		ch.pipeline().addLast(new StringEncoder(CharsetUtil.UTF_8)).addLast(new StringDecoder(CharsetUtil.UTF_8)).addLast(coreServerHandler);
	}

}
